<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!doctype html>
<html class="no-js">
	<head>
		<%@include file="../common/head.jspf"%>
	</head>
	<body>
		<%@include file="../common/header.jspf"%>

		<div class="am-cf admin-main">
			<%@include file="../common/sidebar.jspf"%>

			<!-- content start -->
			<div class="admin-content">
				<div class="admin-content-body">
					<div class="am-cf am-padding am-padding-bottom-0">
						<div class="am-fl am-cf">
							<strong class="am-text-primary am-text-lg">表单</strong> /
							<small>form</small>
						</div>
					</div>

					<hr>

					<div class="am-tabs am-margin" data-am-tabs>
						<ul class="am-tabs-nav am-nav am-nav-tabs">
							<li class="am-active">
								<a href="#tab">基本信息</a>
							</li>
						</ul>

						<div class="am-tabs-bd">
							<div class="am-tab-panel am-fade am-active am-in" id="tab">
								<form class="am-form">
									<input type="hidden" name="admin.id" value="<s:property value='admin.id'/>"/>
									<input type="hidden" name="admin.type" value="2"/>
									
									<div class="am-g am-margin-top-sm">
										<div class="am-u-sm-4 am-u-md-2 am-text-right">
											账号
										</div>
										<div class="am-u-sm-8 am-u-md-4 am-u-end">
											<input type="text" class="am-input-sm" name="admin.userName" value="<s:property value='admin.userName'/>">
										</div>
									</div>

									<div class="am-g am-margin-top-sm">
										<div class="am-u-sm-4 am-u-md-2 am-text-right">
											密码
										</div>
										<div class="am-u-sm-8 am-u-md-4 am-u-end">
											<input type="text" class="am-input-sm" name="admin.passWord" value="<s:property value='admin.passWord'/>">
										</div>
									</div>

									<div class="am-g am-margin-top-sm">
										<div class="am-u-sm-4 am-u-md-2 am-text-right">
											姓名
										</div>
										<div class="am-u-sm-8 am-u-md-4 am-u-end">
											<input type="text" class="am-input-sm" name="admin.realName" value="<s:property value='admin.realName'/>">
										</div>
									</div>
									
								</form>
							</div>
						</div>
					</div>

					<div class="am-margin">
						<button type="button" id="submit" class="am-btn am-btn-primary am-btn-xs">
							提交保存
						</button>
						<button type="button" id="cancel" class="am-btn am-btn-primary am-btn-xs">
							放弃保存
						</button>
					</div>
				</div>

				<%@include file="../common/footer.jspf"%>
			</div>
			<!-- content end -->
		</div>
		<script type="text/javascript">
			$(function(){
				$("#submit").on("click", function(res){
					res.stopPropagation();
					var param = $("form").serialize();
					$.post("/admin/save", param, function(res){
						if(res.success){
							alert(res.message);
							window.location.href = "/admin/list";
						}else{
							alert("操作失败");
						}
					});
				});
				$("#cancel").on("click", function(){
					window.location.href = "/admin/list";
				});
				$("#admin").addClass("am-in");
			});
		</script>
	</body>
</html>
